import React from 'react';
import { Card, Form, Input, Button, message, Avatar } from 'antd';
import { UserOutlined, MailOutlined, PhoneOutlined, EnvironmentOutlined } from '@ant-design/icons';

const Profile = () => {
  const [form] = Form.useForm();

  // 模拟医生信息
  const doctorInfo = {
    name: '张医生',
    title: '主任医师',
    department: '神经内科',
    email: 'doctor@example.com',
    phone: '13800138000',
    hospital: '某某医院',
    introduction: '从事神经内科临床工作20年，擅长脑血管疾病的诊断和治疗。'
  };

  const onFinish = (values) => {
    // 这里添加更新个人信息的逻辑
    message.success('个人信息更新成功！');
  };

  return (
    <div style={{ padding: '24px' }}>
      <Card title="个人中心" style={{ maxWidth: 800, margin: '0 auto' }}>
        <div style={{ textAlign: 'center', marginBottom: 24 }}>
          <Avatar size={100} icon={<UserOutlined />} />
          <h2 style={{ marginTop: 16 }}>{doctorInfo.name}</h2>
          <p>{doctorInfo.title} | {doctorInfo.department}</p>
        </div>

        <Form
          form={form}
          layout="vertical"
          initialValues={doctorInfo}
          onFinish={onFinish}
        >
          <Form.Item
            name="name"
            label="姓名"
            rules={[{ required: true, message: '请输入姓名！' }]}
          >
            <Input prefix={<UserOutlined />} />
          </Form.Item>

          <Form.Item
            name="title"
            label="职称"
            rules={[{ required: true, message: '请输入职称！' }]}
          >
            <Input />
          </Form.Item>

          <Form.Item
            name="department"
            label="科室"
            rules={[{ required: true, message: '请输入科室！' }]}
          >
            <Input />
          </Form.Item>

          <Form.Item
            name="email"
            label="邮箱"
            rules={[
              { required: true, message: '请输入邮箱！' },
              { type: 'email', message: '请输入有效的邮箱地址！' }
            ]}
          >
            <Input prefix={<MailOutlined />} />
          </Form.Item>

          <Form.Item
            name="phone"
            label="电话"
            rules={[{ required: true, message: '请输入电话！' }]}
          >
            <Input prefix={<PhoneOutlined />} />
          </Form.Item>

          <Form.Item
            name="hospital"
            label="所属医院"
            rules={[{ required: true, message: '请输入所属医院！' }]}
          >
            <Input prefix={<EnvironmentOutlined />} />
          </Form.Item>

          <Form.Item
            name="introduction"
            label="个人简介"
          >
            <Input.TextArea rows={4} />
          </Form.Item>

          <Form.Item>
            <Button type="primary" htmlType="submit" block>
              保存修改
            </Button>
          </Form.Item>
        </Form>
      </Card>
    </div>
  );
};

export default Profile; 